<template>
  <div>
    <ul>
      <li v-for="mes in messageList" :key="mes.id">
        <router-link :to="{
              path:'/home/message/detail/',
              query:{
                id:mes.id,
                title:mes.title
               }
            }">
          {{ mes.title }}
        </router-link>&nbsp;&nbsp;
        <button @click="pushShow(mes)">push查看</button>
        <button @click="replaceShow(mes)">replace查看</button>
      </li>
    </ul>
    <hr>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "Message",
  data() {
    return {
      messageList: [
        {id: '001', title: 'message001'},
        {id: '002', title: 'message002'},
        {id: '003', title: 'message003'},
      ]
    }
  },
  methods: {
    pushShow(m) {
      this.$router.push({
        name: 'Particulars',
        query: {
          id: m.id,
          title: m.title
        }
      })
      console.log(m)
    },
    replaceShow(m) {
      this.$router.replace(({
        name: 'Particulars',
        query: {
          id: m.id,
          title: m.title
        }
      }))
    }
  }
}
</script>

<style scoped>

</style>